import React from 'react'

class ListDemo extends React.Component {
    constructor(props) {
        super(props)
        this.state = { list: [
            {id: 'id-1', title: '标题1'},
            {id: 'id-2', title: '标题2'},
            {id: 'id-3', title: '标题3'},
        ] }
    }
    render() {
        return <div>
            <h3>列表</h3>
            <ul>{this.state.list.map((item, index) => {
                // 必填，不能是index或者random
                return <li key={item.id}>index: {index}; title: {item.title}</li>
            })}</ul>
        </div>
    }
}

export default ListDemo